<?php

namespace App\Common\Traits;

use App\Models\Attachment;

trait HasAttachments
{
    public function attachments()
    {
        return $this
            ->morphToMany(
                Attachment::class,
                'subject',
                'model_has_attachments'
            )
            ->withPivot('type');
    }
}
